package test29;


/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-04-22
 * Time: 17:11
 */
//https://www.nowcoder.com/questionTerminal/1d18c0841e64454cbc3afaea05e2f63c?


import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static Scanner in = new Scanner(System.in);
    public static PrintStream out = System.out;

    public static int findCoin(int n) {
        if (n == 1)
            return 0;
        if (n <= 3)
            return 1;
        int metage, rest, times = 0;
        // 3等分前，先加2，使得metage的值尽量大于rest
        // (metage,metage,rest)
        metage = (n + 2) / 3;
        rest = n - 2 * metage;
        // 每次选出最多的一部分
        times = 1 + findCoin(Math.max(metage, rest));
        return times;
    }

    public static void main(String[] args) {
        int n;
        while ((n = in.nextInt()) > 0) {
            out.println(findCoin(n));
        }
    }
}



